<%-- 
    Document   : insertUser
    Created on : 25 Nov 12, 20:46:16
    Author     : user
--%>

<%@page import="javax.swing.JOptionPane"%>
<%
            bunga.KoneksiDatabase conn = new bunga.KoneksiDatabase();
%>
<%@page import="java.sql.Statement"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Form Konfirmasi</title>
    <link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Insert User</title>
        </head>
        <body>
            <form action="form_konfirmasi.jsp"  method="post">
                <div id="wrapper">
                    <div id="header-wrapper">
                        <div id="header" class="container">
                            <div id="menu">
                                <ul>
                                    <li><a href="form_utama.jsp" class="selected">Home</a></li>
                                    <li><a href="aboutUs.jsp" class="selected">About Us</a></li>
                                    <li><a href="ourLocation.jsp" class="selected"> Our Location</a></li>
                                    <li><a href="cek_status.jsp">Cek Status Pesanan</a></li>
                                </ul>
                            </div>
                        </div>
                        <div id="banner">
                            <div class="content"><img src="images/header.jpg" width="1000" height="200" alt="" /></div>
                        </div>
                    </div>
                    <div>
                        <table align="center" width="600" border="2">
                            <tr>
                                <td>
                                    <pre>
                                         <jsp:useBean id="input" scope="session" class="bunga.DataPesanan"/>
                                        <jsp:setProperty name="input" property="idPesanan" value="${param.idPesanan}"/>
                                        <jsp:setProperty name="input" property="namaPenerima" value="${param.namaPenerima}"/>
                                        <jsp:setProperty name="input" property="namaPemesan" value="${param.namaPemesan}"/>
                                        <jsp:setProperty name="input" property="alamatPenerima" value="${param.alamatPenerima}"/>
                                        <jsp:setProperty name="input" property="alamatPemesan" value="${param.alamatPemesan}"/>
                                        <jsp:setProperty name="input" property="teleponPenerima" value="${param.teleponPenerima}"/>
                                        <jsp:setProperty name="input" property="teleponPemesan" value="${param.teleponPemesan}"/>
                                        <jsp:setProperty name="input" property="email" value="${param.email}"/>
                                        <jsp:setProperty name="input" property="tglKirim" value="${param.tglKirim}"/>
                                        <jsp:setProperty name="input" property="jamKirim" value="${param.jamKirim}"/>
                                        <jsp:setProperty name="input" property="ucapan" value="${param.ucapan}"/>
                                        <jsp:setProperty name="input" property="jumlah" value="${param.jumlah}"/>
                                        <%
                                                    try {
                                                       if (!input.getIdPesanan().equals("")
                                                                && !input.getNamaPemesan().equals("")
                                                                && !input.getAlamatPenerima().equals("")
                                                                && !input.getAlamatPemesan().equals("")
                                                                && !input.getTeleponPenerima().equals("")
                                                                && !input.getTeleponPemesan().equals("")
                                                                && !input.getEmail().equals("")
                                                                && !input.getTglKirim().equals("")
                                                                && !input.getJamKirim().equals("")
                                                                && !input.getUcapan().equals("")) {
                                                             String query = "INSERT INTO dataPesanan (idPesanan, namaPenerima, namaPemesan, "
                                                                    + " alamatPenerima, alamatPemesan, teleponPenerima, teleponPemesan, email, tglKirim, "
                                                                    + " jamKirim, ucapan) values('" + input.getIdPesanan() + "' , '" + input.getNamaPenerima() + "' , '"
                                                                    + input.getNamaPemesan() + "' , '"
                                                                    + input.getAlamatPenerima() + "' , '" + input.getAlamatPemesan() + "' , '"
                                                                    + input.getTeleponPenerima() + "' , '" + input.getTeleponPemesan() + "' , '"
                                                                    + input.getEmail() + "' , '" + input.getTglKirim() + "' , '" + input.getJamKirim() + "' , '"
                                                                    + input.getUcapan() + "')";

                                                            java.sql.Statement statement = conn.getDBConnection().createStatement();
                                                            int s = statement.executeUpdate(query);

                                                            out.println("<center>");
                                                            out.println("Success \n");

                                                            statement.close();
                                                        } else {
                                                            %>
                                                            <script>
                                                alert('Cek Form Pengisian Anda!');
                                                history.back();
                                                </script>
                                        <%
                                                            }
                                                    } catch (Exception ex) {
                                                    }
                                        %>
                    <tr>
                        <td><input type="submit" value="Show"/></td>
                    </tr>
                                    </pre>
                        </table>

                    </div>
                </div>

            </form>
            <div id="footer">
                <p>Copyright (c) 2012. All rights reserved.<br />Designed & Developed by <a href="http://www.facebook.com/yulius.ferdian" target="_blank">Yulius</p>
            </div>
        </body>
    </html>
